package com.twxm.breed.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsKey;
import com.gitee.sunchenbin.mybatis.actable.annotation.IsNotNull;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.Data;

import java.util.Date;

@Data
@Table(name = "device")
public class DeviceInfo {
    @IsKey
    @TableId
    @Column(comment = "设备id",type = MySqlTypeConstant.VARCHAR)
    private String deviceId;

    @Column(name = "category_id",comment = "设备类别",type = MySqlTypeConstant.INT)
    @IsNotNull
    private CategoryInfo categoryInfo;

    @Column(comment = "设备位置",type = MySqlTypeConstant.VARCHAR, name = "pond_id")
    private FishPond fishPond;

    @Column(comment = "设备启动时间",type = MySqlTypeConstant.DATETIME)
    private Date startTime;

    @Column(comment = "设备状态",defaultValue = "0")
    private int status;

    @Column(comment = "设备图片")
    private String image;

    @Column(comment = "采集频率",defaultValue = "30")
    private int minute;

    public DeviceInfo(String deviceId, CategoryInfo categoryInfo, FishPond fishPond, String path){
        this.deviceId = deviceId;
        this.categoryInfo = categoryInfo;
        this.fishPond = fishPond;
        this.image = path;
    }
}

